<?php

declare(strict_types=1);

namespace App\Info\Model;

use Mine\MineModel;

/**
 * @property int $id ID
 * @property string $title 标题
 * @property string $summary 摘要
 * @property string $author 作者
 * @property int $class_id 分类id
 * @property string $thumb 缩略图
 * @property string $content 内容
 * @property int $display_order 排序
 * @property int $is_recommend 是否推荐
 * @property int $created_by 创建者
 * @property int $updated_by 更新者
 * @property int $status 状态
 * @property int $create_time 创建时间
 * @property int $update_time 更新时间
 */
class InfoItem extends MineModel
{
    protected ?string $dateFormat = 'U';
    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'info_item';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'title','author', 'summary', 'class_id', 'thumb', 'content', 'display_order', 'is_recommend', 'created_by', 'updated_by', 'status', 'create_time', 'update_time'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'class_id' => 'integer', 'display_order' => 'integer', 'is_recommend' => 'integer', 'created_by' => 'integer', 'updated_by' => 'integer', 'status' => 'integer', 'create_time' => 'integer', 'update_time' => 'integer'];

    public function class(){
        return $this->hasOne(InfoClass::class,'id','class_id');
    }
}
